" Vim syntax file
" Language:	Python XML for the seagull engine
" Maintainer:	Jonathan Slenders
" Last Change:	Fri Nov  7 14:25:56 CET 2008
" Filenames:	*.page
"       Copy to: /usr/share/vim/vim*/syntax/
" Note: add following line to filetype.vim
"  au BufNewFile,BufRead *.page setf page

if version < 600
	syn clear
elseif exists("b:current_syntax")
	finish
endif

syn case match

" ===================[ Comments ]==================
syn region ppComment
	\ start=+<!--+
	\ end=+-->+
	\ contains=ppTodo,@Spell

syn keyword ppTodo TODO NOTE FIXME contained


" ===================[ HTML markup ]==================
syn region ppXMLTag
	\ start="<[^!]"
	\ end=">"
	\ contains=ppComment,ppXMLParam,ppSpecialTag

syn region ppXMLParam contained
	\ start=+"+
	\ end=+"+
	\ contains=ppComment,ppSpecialTag

syn region ppSpecialTag contained
	\ start="{"
	\ end=""
	\ contains=ppScript,ppAssignmentTag,ppInvalidSpecialTag,ppComment,ppPageTag,ppParamTag,ppMetaTag,ppFilterTag,ppIncludeTag,ppPlaceholderTag,ppMasterTag


" ===================[ Special tags ]==================

syn region ppIncludeTag
	\ start="{<\?\s*"
	\ end="\\\?}"
	\ contains=ppIncludeAttributes,ppAttributeValue
syn region ppScript
	\ start="{%"
	\ end="%\\\?}"
	\ contains=ppScriptcomment,ppKeywords,ppNumber,ppString
syn region ppAssignmentTag
	\ start="{="
	\ end="=\\\?}"
	\ contains=ppKeywords,ppNumber,ppString
syn region ppInvalidSpecialTag
	\ start="{[a-z]"
	\ end="\\\?}"
syn region ppMasterTag
	\ start="{master"
	\ end="\\\?}"
	\ contains=ppMasterAttributes,ppAttributeValue
syn region ppPlaceholderTag
	\ start="{placeholder"
	\ end="\\\?}"
	\ contains=ppPlaceholderAttributes,ppAttributeValue
syn region ppCallTage
	\ start="{call"
	\ end="\\\?}"
	\ contains=ppCallAttributes,ppAttributeValue
syn region ppContentTag
	\ start="{content"
	\ end="\\\?}"
	\ contains=ppContentAttributes,ppAttributeValue
syn region ppPageTag
	\ start="{page"
	\ end="\\\?}"
	\ contains=ppPageAttributes,ppAttributeValue
syn region ppParamTag
	\ start="{param"
	\ end="\\\?}"
	\ contains=ppParamAttributes,ppAttributeValue
syn region ppMetaTag
	\ start="{meta"
	\ end="\\\?}"
	\ contains=ppMetaAttributes,ppAttributeValue
syn region ppFilterTag
	\ start="{filter"
	\ end="\\\?}"
	\ contains=ppFilterAttributes, ppAttributeValue

" ===================[ Attributes for special tags ]==================

syn keyword ppIncludeAttributes render p o contained
syn keyword ppMasterAttributes path contained
syn keyword ppPlaceholderAttributes name contained
syn keyword ppCallAttributes entry contained
syn keyword ppContentAttributes name contained
syn match ppPageAttributes "external\|disabled\|content-type\|compress-whitespace\|output" contained
syn match ppParamAttributes "name\|class\|type\|description\|contained\|default-value\|set\|get" contained
syn keyword ppMetaAttributes name value contained
syn keyword ppFilterAttributes name contained

syn region ppAttributeValue start=+"+ end=+"+ contained

" ===================[ Embedded Python code ]==================

" All keywords
syn keyword ppKeywords def enddef if else endif class endclass while endwhile for endfor print try except endtry in contained

" Strings
syn region ppString contained
	\ start=+"\|'+
	\ end=""
	\ contains=ppDoubleQuotedString,ppDoubleQuotedMultilineString,ppSingleQuotedString,ppSingleQuotedMultilineString
syn region ppDoubleQuotedString contained
	\ start=+"+
	\ end=+"+
syn region ppSingleQuotedString contained
	\ start=+'+
	\ end=+'+
syn region ppDoubleQuotedMultilineString contained
	\ start=+"""+
	\ end=+"""+
syn region ppSingleQuotedMultilineString contained
	\ start=+'''+
	\ end=+'''+

" Comments
syn region ppScriptcomment contained
	\ start="#"
	\ end="\n"
	\ contains=ppTodo,@Spell


" ===================[ Highlight ]==================

syn sync minlines=100

hi def link ppComment Comment
hi def link ppScriptComment Comment
hi def link ppTodo Todo

hi def link ppInvalidSpecialTag Error
hi def link ppContentTag Define
hi def link ppPageTag Define
hi def link ppMasterTag Define
hi def link ppPlaceholderTag Define
hi def link ppCallTage Define
hi def link ppParamTag Define
hi def link ppMetaTag Define
hi def link ppfilterTag Define
hi def link ppIncludeTag Define

hi def link ppContentAttributes Type
hi def link ppPageAttributes Type
hi def link ppMasterAttributes Type
hi def link ppPlaceholderAttributes Type
hi def link ppCallAttributes Type
hi def link ppMetaAttributes Type
hi def link ppParamAttributes Type
hi def link ppFilterAttributes Type
hi def link ppIncludeAttributes Type

hi def link ppAttributeValue String
 
hi def link ppScript Function
hi def link ppAssignmentTag Function
 
hi def link ppKeywords Keyword
hi def link ppString String

hi def link ppXMLTag Statement
hi def link ppXMLParam String

let b:current_syntax = "pp"

" let &cpo = s:xml_cpo_save
" unlet s:xml_cpo_save

" vim: ts=8
